FROM node:20.19.4-slim

# 设置时区为上海
ENV TZ=Asia/Shanghai

WORKDIR /app

# 安装全局工具
RUN npm install -g pm2

# 把现成文件复制进容器
COPY ./node_modules ./node_modules
COPY ./dist ./dist
COPY ./.env.production ./.env.production
COPY ./.env ./.env
COPY ./package.json ./package.json

# 暴露端口 4567
EXPOSE 4567

# 用 package.json 里的脚本启动
CMD ["pm2-runtime", "start", "dist/src/main.js", "--name", "nest-fastify-panload-api"]
